/**
 * This function is provided to help you get started
 * with shaders.  Don't worry too much about what it
 * is doing for now.  We will come back to this in
 * later lessons.
 *
 * For this lesson, you should just call this function
 * once you have set up your shader.
 */
module.exports = function drawTriangle(gl) {
  var buffer = gl.createBuffer()
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer)
  gl.bufferData(gl.ARRAY_BUFFER, 
    new Float32Array([
      -1, 0, 1, 1, 0,
      0, -1, 0, 1, 1,
      1, 1,  1, 0, 1]), 
    gl.STREAM_DRAW)
  gl.enableVertexAttribArray(0)
  gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 20, 0)
  gl.enableVertexAttribArray(1)
  gl.vertexAttribPointer(1, 3, gl.FLOAT, false, 20, 8)
  gl.drawArrays(gl.TRIANGLES, 0, 3)
  gl.bindBuffer(gl.ARRAY_BUFFER, null)
  gl.disableVertexAttribArray(0)
  gl.deleteBuffer(buffer)
}